package hello.base;

import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import hello.define.StateEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

import static java.time.LocalDateTime.now;


@Getter
@Setter
public class BaseEntity<T> extends Model {

    @TableId
    @ApiModelProperty(value = "表主键")
    private String id = IdUtil.fastSimpleUUID();

    @ApiModelProperty(value = "数据创建时间")
    private LocalDateTime createTime = now();

    @ApiModelProperty(value = "数据更新时间")
    private LocalDateTime updateTime = now();

    @ApiModelProperty(value = "数据状态，ON为数据启用，OFF为数据停用但仍在前端显示，DEL为数据对用户来说已经删除，只在数据库中做保留")
    private StateEnum state = StateEnum.ON;
}


